import React from 'react'

import './HeaderAvatar.css'
import defaultAvatarSrc from '../../../../../res/images/web/shared/缺省头像.png'

const HeaderAvatar = props => {
    const {
        avatarUrl,
        width,
    } = props

    const style = {
        background: `url(${avatarUrl ? avatarUrl : defaultAvatarSrc}) center/cover, #fff`,
    }

    if (width) {
        style.width = width
        style.height = width
    }

    return <div
        className='my-header-avatar-container'
        style={style}
    />

}

export default HeaderAvatar
